package kz.myproject.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point for the simple RPC example application.
 */
public class SimpleRPC implements EntryPoint {

	/**
	 * Remote service proxy for the greeting service.
	 */
	private final GreetingServiceAsync greetingService = GWT
			.create(GreetingService.class);

	/**
	 * Entry point method.
	 */
	public void onModuleLoad() {

		final Label label = new Label();

		greetingService.phrase(new AsyncCallback<String>() {

			@Override
			public void onFailure(Throwable caught) {
				label.setText("Remote Procedure Call - Failure");
			}

			@Override
			public void onSuccess(String result) {
				label.setText(result);
			}
		});

		RootPanel.get().add(label);

	}
}
